package com.lzy.crm.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.lzy.crm.base.mybatis.BaseMapper;
import com.lzy.crm.base.mybatis.Example;
import com.lzy.crm.base.service.BaseServiceImpl;
import com.lzy.crm.base.util.StringUtil;
import com.lzy.crm.dao.ProfitRuleMapper;
import com.lzy.crm.dao.criteria.ProfitRuleCriteria;
import com.lzy.crm.domain.ProfitRule;
import com.lzy.crm.service.ProfitRuleService;

/**
 * 分润规则明显
 * @author csp
 *
 */
@Service("profitRuleService")
public class ProfitRuleServiceImpl extends BaseServiceImpl<ProfitRule,ProfitRuleCriteria> implements ProfitRuleService{

	@Resource
	private ProfitRuleMapper profitRuleMapper;
	
	@Override
	public BaseMapper<ProfitRule, ProfitRuleCriteria> getBaseMapper() {
		return profitRuleMapper;
	}

	
	/**
	 * 查询分润信息
	 * @param userLevel
	 * @return
	 */
	public List<ProfitRule> getProfitRuleList(String userLevel,String prifitLevel){
		Example<ProfitRuleCriteria> example = new Example<ProfitRuleCriteria>(ProfitRuleCriteria.class);
		ProfitRuleCriteria profitRuleCriteria = example.createCriteria();
		if(StringUtil.isNotEmpty(userLevel)){
			profitRuleCriteria.andUserLevelEqualTo(userLevel);
		}
		if(StringUtil.isNotEmpty(prifitLevel)){
			profitRuleCriteria.andPrifitLevelGreaterThan(prifitLevel);
		}
		return profitRuleMapper.getListByExample(example);
	}
	
	
}
